package com.zhou.cloud.consumer.service;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

/**
 * @descrition:
 * @author: zhouyongjun
 * @date: 2022/7/28
 **/
@Service
@Slf4j
public class KafkaConsumerService {
    @KafkaListener(topics = "topic1")
    public void onMessage1(ConsumerRecord<?, ?> record){
        // 消费的哪个topic、partition的消息,打印出消息内容
//        System.out.println("简单消费："+record.topic()+"-"+record.partition()+"-"+record.value());
        log.warn("简单消费3：topic={},partition={},message={}",record.topic(),record.partition(),record.value());
    }
}
